<%--
  Created by IntelliJ IDEA.
  User: zhl
  Date: 2021/8/12
  Time: 14:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>shop</title>
</head>
<body>
    <jsp:include page="../../common/css_js.jsp"/>
    <div class="container">
        <h3>商品管理</h3>
        <a class="btn btn-success" onclick="add()">添加</a>
        <table class="table" id="table_id_example">
            <thead>
                <tr>
                    <td>商品编号</td>
                    <td>商品</td>
                    <td>商品价格</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <c:forEach items="${goodsList}" var="one">
                    <tr>
                        <td>${one.goodsId}</td>
                        <td>${one.goodsName}</td>
                        <td>${one.price}</td>
                        <td>
                            <a href="?id=${one.goodsId}" onclick="edit()">修改</a>&nbsp
                            <a href="#" onclick="del(id)">删除</a>
                        </td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>
    </div>

    <script>
        //添加操作
        function add() {

        }
        //修改操作
        function edit() {

        }
        //删除操作
        function del(id) {
            if (confirm("你真的要删除吗？")){
                location.href = "del?id=" +id;// del?id=${one.id}
            }
        }
    </script>
</body>
</html>
